<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>绘制一个右上角的四分之一扇形</title>
    <style>
        canvas {
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
<canvas width="600" height="400"></canvas>
<script>
    var myCanvas = document.querySelector('canvas');
    var ctx = myCanvas.getContext('2d');
    /*绘制*/
    var w = ctx.canvas.width;
    var h = ctx.canvas.height;
    /*把起点放到圆心位置*/
    ctx.moveTo(w/2,h/2);
    ctx.arc(w/2,h/2,150,0,-Math.PI/2,true)
    /*闭合路径*/
    ctx.closePath();
    ctx.stroke();
    ctx.fill();
</script>
</body>
</html>
